<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>人事档案</title>
<link href="<c:url value='/insdep/reset.min.css' />" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/easyui_full.css'/>" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/icon.css'/>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<c:url value='/insdep/jquery-1.11.3.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/jquery.easyui-1.5.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/insdep-extend.min.js'/>"></script>

</head>
<body>
<script type="text/javascript">
function fornatter_sex(value, row, index){
	return{
		"1": "男",
		"0": "女"
	}[value];
}
function fornatter_type(value, row, index){
	return{
		"regularemployee": "正式员工",
		"trainee": "实习生"
	}[value];
}
function fornatter_state(value, row, index){
	return{
		"1": "在职",
		"0": "离职"
	}[value];
}


function note_bianji(val,row,index){
	var edit="";
	if(row.empstate==1){
		edit= '<a class="easyui-linkbutton button-teal iconfont icon-hetongqicao" style="color:white;padding-left:9%;font-size:14px;padding-right:9%;margin-right:5%" onclick="edit('+index+')">编辑</a>';
		}
		var chakan="";
		chakan= '<a class="easyui-linkbutton button-blue iconfont icon-gongwenchaxun" style="color:white;padding-left:9%;font-size:14px;padding-right:9%;margin-right:5%" onclick="chakan('+index+')">详情</a>';
		return edit+chakan;	
	}

$(function(){
	//按条件查询用户
	 $("#queryer").linkbutton({onClick:function(){ 
		 $('#EmpDAnan_search_from').form('submit', {   
			 	onSubmit: function(param){  
			 		param.page = '1';    
			        param.rows = '5';
			    }  ,
			    success:function(data){    //表单查询数据刷新DataGrid
			    	var resultData = $.parseJSON(data);  
			    	$('#rstable').datagrid('loadData', resultData); 
			    }    
			}); 
	 }});
	
	 $("#reset_rs").linkbutton({
			onClick : function() {
				$("#EmpDAnan_search_from").form('reset');
			}
		});
	 
})
</script>
<script type="text/javascript">
 $(function() {
	$("#rstable").datagrid({onBeforeLoad:function(parm){
		parm.empName=$("#empName").val();
		parm.empState=$("#empState").val();
		parm.archivesEmptype=$("#archivesEmptype").val();
	}})
})
</script>
<script type="text/javascript">
$(function() {

	//新建窗口
  	 $(".add_btn").linkbutton({onClick:function(){
  		 $("#rswin").window({
		      width: 900,
	          height: 600,
	          title: '员工档案信息窗口',
	          iconCls: 'icon-update',
	          modal: true,//表示模式窗口
	          maximizable:false,
	          minimizable:false,
	          collapsible:false,
	          draggable: false ,
			  href:'increase'//请求远程数据
			});
  	 }
  	 }); 
  	

})
</script>
<script type="text/javascript">
/**
	 *编辑事件
	 */
	function edit(index){
		$("#rswin").window({
				  width: 900,
		          height: 600,
		          title: '修改员工档案信息窗口',
		          iconCls: 'icon-update',
		          modal: true,//表示模式窗口
		          maximizable:false,
		          minimizable:false,
		          collapsible:false,
		          draggable: false ,
				  href:'edito_emp',//请求远程数据
				});
		$('#rstable').datagrid('selectRow',index);
	 	var row = $('#rstable').datagrid('getSelected');
	 	alert(row.empid);
	 	var empid = row.empid;
		 $.post("editemp", {empId:empid} ,function(info){
			 $('#edit_dananemp_form').form('load',info);
         });
 	    alert(row);
 	
 }
</script>
<script type="text/javascript">
/**
 *查询所有
 */
function chakan(index){
	$("#rswin").window({
			  width: 900,
		      height: 600,
	          title: '修改员工档案信息窗口',
	          iconCls: 'icon-update',
	          modal: true,//表示模式窗口
	          maximizable:false,
	          minimizable:false,
	          collapsible:false,
	          draggable: false ,
			  href:'check_emp',//请求远程数据
			});
	$('#rstable').datagrid('selectRow',index);
 	var row = $('#rstable').datagrid('getSelected');
 	alert(row.empid);
 	var empid = row.empid;
	 $.post("checkemp", {empId:empid} ,function(info){
		 $('#check_daemp_form').form('load',info);
     });
	    alert(row);
	
}
</script>



<div class="easyui-layout theme-layout" data-options="fit:true">
    <div class="theme-header-layout" style="height:130px;border: 0px solid red" data-options="region:'north'">
    	<div style="margin-left: 5%;width:80%;margin-right:5%;margin-top:20px;border: 0px solid green">
        <form action="get_AllEmpInfo" id="EmpDAnan_search_from" class="searcher-form" method="post">
    		<input id="empName" name="empName" class="easyui-textbox"  style="width: 32%;"  labelAlign="right" label="姓名：" labelWidth="150px"> 
			<select id="empState" name="empState" id="" class="easyui-combobox" style="width: 31%;" labelAlign="right" label="状态：" editable="false" labelWidth="150px">
				<option value="">---请选择---</option>
				<option value="1">在职</option>
				<option value="0">离职</option>
			</select>
			<select id="archivesEmptype" name="archivesEmptype" id="" class="easyui-combobox" style="width: 32%;" labelAlign="right" label="类型：" editable="false" labelWidth="150px">
				<option value="">---请选择---</option>
				<option value="trainee">实习生</option>
				<option value="regularemployee">正式员工</option>
			</select>
			<div style="margin-left:25%;margin-top:30px;border: 0px solid red">
			<a id="queryer"  class="easyui-linkbutton button-line-blue" 
			style="width: 14%;height: 30px;"><i class="iconfont icon-roundcheck"></i>查询</a>
			<a id="reset_rs"  class="easyui-linkbutton button-line-blue" 
			style="width: 14%;height: 30px;margin-left: 20%"><i class="iconfont icon-refresh"></i>重置</a>
			<a id="increase"  class="easyui-linkbutton button-line-blue add_btn" 
			style="width: 14%;height: 30px;margin-left: 20%"><i class="iconfont icon-friendadd"></i>增加</a>
			
			<!-- <a id="increase"  class="easyui-linkbutton button-line-orange button-line-unbackground add_btn" 
			style="width: 10%;height: 30px;">查询</a> -->
    		</div>
    	</form>
    	</div>
    </div>
    <div class="theme-center-layout" style="border: 0px solid red" data-options="region:'center',title:'人事档案信息表'">
        <!-- <div style="margin-left: 12%;margin-right:5%;margin-top:20px;border: 0px solid red"> -->
        <!--  class="table table-striped" -->
        <table id="rstable" style="width:100%;height: 100%" class="easyui-datagrid" 
		data-options="
		height:450,
		fitColumns:true,
		url:'get_AllEmpInfo',
		singleSelect:true,
		rownumbers: true,
		<!-- toolbar: '#tb', -->
		nowrap:false, 
		autoRowHeight:true,
		pagination:true,
		pageSize: 5,
		pageList:[5,10,15,20]
		">
	<thead>
		<tr>
			<th style="font-weight: 700;width: 10%" align="center" data-options="field:'deptname'">部门名称</th>
			<th style="font-weight: bold;width: 10%" align="center" data-options="field:'empname'">姓名</th>
			<th style="font-weight: bold;width: 10%" align="center" data-options="formatter:fornatter_sex,field:'empsex'">性别</th>
			<th style="font-weight: bold;width: 11%" align="center" data-options="field:'birthday'">出生日期</th>
			<th style="font-weight: bold;width: 10%" align="center" data-options="formatter:fornatter_type,field:'emptype'">员工类型</th>
			<th style="font-weight: bold;width: 10%" align="center" data-options="formatter:fornatter_state,field:'empstate'">在职状态</th>
			<th style="font-weight: bold;width: 10%" align="center" data-options="field:'positionname'">职位</th>
			<th style="font-weight: bold;width: 11%" align="center" data-options="field:'entertime'">入职日期</th>
			
			
			<th field="note" style="font-weight: bold;width: 18%;" align="center" data-options="formatter:note_bianji">操作</th>
		</tr>
	</thead>
</table>
<!-- </div> -->

    </div>

</div>
<div id="rswin"></div>
</body>
</html>